<!DOCTYPE html>
<html>
<head lang="en">
    <meta name="viewport"
          content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <meta charset="UTF-8">
    <!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css"
          integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"
            integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
            crossorigin="anonymous"></script>
    <title></title>
</head>
<body>
<div class="container">
    <div class="text-center">
    <img src="" date_id="" id="imgbox" data_type="" alt="..." class="img-thumbnail" style="max-height: 840px;cursor: pointer;">
    </div>
    <div class="text-center" style="margin-top: 20px;">
        <button type="button" id="prePic" class="btn btn-default">上一张</button>
        <button type="button" id='nextPic' class="btn btn-primary">下一张</button>
    </div>
</div>
<script type="text/javascript">
    $(".img-thumbnail").attr({src: "http://img.mmjpg.com/2016/743/5.jpg"});
    $(function(){
        $("#nextPic,#imgbox").click(function(){
            $.ajax({
                url:"http://tp5.dtshy.win:8080/index.php/index/index/getNext.html",
                type:"get",
                data:"id="+$(".img-thumbnail").attr("data_id")+"&type="+$(".img-thumbnail").attr("data_type"),
                success:function(imgobj){
                    if(imgobj.src){
                        $(".img-thumbnail").attr({src:imgobj.src});
                        $(".img-thumbnail").attr({data_id:imgobj.id});
                        $(".img-thumbnail").attr({data_type:imgobj.type});
                    }else if(imgobj.errmsg){
                        alert(imgobj.errmsg);
                    }

                }
            });
        });
        $("#prePic").click(function(){
            $.ajax({
                url:"http://tp5.dtshy.win:8080/index.php/index/index/getPre.html",
                type:"get",
                data:"id="+$(".img-thumbnail").attr("data_id")+"&type="+$(".img-thumbnail").attr("data_type"),
                success:function(imgobj){
                    if(imgobj.src){
                        $(".img-thumbnail").attr({src:imgobj.src});
                        $(".img-thumbnail").attr({data_id:imgobj.id});
                        $(".img-thumbnail").attr({data_type:imgobj.type});
                    }else if(imgobj.errmsg){
                        alert(imgobj.errmsg);
                    }

                }
            });
        });
    });
</script>
</body>
</html>